package com.zj.inoutput.common.constant;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

import java.util.HashMap;
import java.util.Map;

/**
 * @author DuanYu Email:<a>z-houjie@qq.com</a>
 * @date 2022-02-21 19:35
 */
@Getter
@RequiredArgsConstructor
public enum DeleteStatus {

    /**
     * 未删除
     */
    STAFF(0, "未删除"),

    /**
     * 已删除
     */
    CUSTOMER(1, "已删除");

    private final Integer value;

    private final String description;

    private static final Map<Integer, String> DESCRIPTION_DICT = new HashMap<>();

    private static final Map<String, Integer> VALUE_DICT = new HashMap<>();

    static {
        for (DeleteStatus value : DeleteStatus.values()) {
            DESCRIPTION_DICT.put(value.getValue(), value.getDescription());
            VALUE_DICT.put(value.getDescription(), value.getValue());
        }
    }

    public static String getTypeName(Integer key) {
        return DESCRIPTION_DICT.getOrDefault(key, null);
    }

    public static Integer getTypeValue(String key) {
        return VALUE_DICT.getOrDefault(key, null);
    }
}
